package com.mingqijia.gassafety.shared.handler;

import lombok.EqualsAndHashCode;
import lombok.Value;
import org.springframework.security.core.AuthenticationException;

/**
 * 验证码验证失败异常
 * @author Damon S.
 * @version v0.2
 * @date {YEAR}年{MONTH}月{DAY}日 {TIME}
 */
@Value
@EqualsAndHashCode(callSuper = true)
public class GlobalAuthenticationException extends AuthenticationException {

    boolean logStack;
    int code;

    public GlobalAuthenticationException(String msg) {
        super(msg);
        this.code = 0;
        this.logStack = false;
    }

    public GlobalAuthenticationException(int code, String msg) {
        super(msg);
        this.code = code;
        this.logStack = false;
    }

    public GlobalAuthenticationException(String msg, boolean logStack) {
        super(msg);
        this.code = 0;
        this.logStack = logStack;
    }

    public GlobalAuthenticationException(String msg, Throwable t) {
        super(msg, t);
        this.code = 0;
        this.logStack = true;
    }
}
